package com.cdtye.shuoh.controller.device;

import com.cdtye.common.webcore.web.AjaxJson;
import com.cdtye.shuoh.domain.device.entity.DeviceInfo;
import com.cdtye.shuoh.domain.device.vo.DeviceInfoVo;
import com.cdtye.shuoh.service.device.DeviceInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 子设备管理Controller
 * @author ZhongWang Wang
 * @date 2022-12-21
 */

@RestController
@RequestMapping("/deviceInfo")
public class DeviceInfoController {

    @Autowired
    private DeviceInfoService deviceInfoService;

    /**
     * 分页查询
     * @param vo
     * @return
     */
    @PostMapping("/pageList")
    public AjaxJson pageList(@RequestBody DeviceInfoVo vo){
        return AjaxJson.success(deviceInfoService.pageList(vo));
    }


    /**
     * 更新子设备
     * @param deviceInfo
     * @return
     */
    @PostMapping("updateDeviceInfo")
    public AjaxJson updateDeviceInfo(@RequestBody DeviceInfo deviceInfo){
        return AjaxJson.success(deviceInfoService.updateDeviceInfo(deviceInfo));
    }

    /**
     * 根据id获取设备详情
     * @param id
     * @return
     */
    @GetMapping("/getById")
    public AjaxJson getById(String id){
        return AjaxJson.success(deviceInfoService.getById(id));
    }
}
